import React from 'react';
import { Modal, notification } from 'antd';
import ajax from '../../utils/ajax';
import { Select } from 'antd';

//图片的查看详情组件

class ExamineView extends React.Component {

  state = {
    dn : '',  //显示的图片列表
    status : 1,
    examineViewVisible: false
  }

  examineView = () => {
    var _this = this;
    let dn = _this.props.dn;
    _this.setState({ dn: dn });
    _this.setState({ examineViewVisible: true });
    
  }

  hideModal = () => {
    this.setState({ examineViewVisible: false });
  }

  handleModalOk = () => {
    var _this = this;
    let status = _this.state.status;
    let dn = _this.state.dn;
    this.setState({ examineViewVisible: false });
    ajax.post({
          url: "/accountbill/modifyStatus",
          params: {dn : dn, status : status},
          success: function (res) {
            window.location.reload();
          }
    })
  }

  getSelectValue = (value) => {
    this.setState({status: value});
  }

  render() {
    return (
      <div>
        <a href="javascript:void(0)" onClick={this.examineView}>审核</a>
        <Modal title="审核" visible={this.state.examineViewVisible} onOk={this.handleModalOk}
          onCancel={this.hideModal}>
          <Select
            showSearch
            style={{ width: 200 }}
            placeholder="请选择"
            optionFilterProp="children"
            filterOption={(input, option) => option.props.value.toLowerCase().indexOf(input.toLowerCase()) >= 0}
            onChange={this.getSelectValue}
          >
            <Option value="0">不通过</Option>
            <Option value="1">通过</Option>
          </Select>
        </Modal>
      </div>
    );
  }
}

export default ExamineView;
